package com.powernode.ssm.controller;

import com.powernode.ssm.pojo.vo.*;
import com.powernode.ssm.pojo.po.*;
import com.powernode.ssm.utils.*;
import com.powernode.ssm.service.TestPdfService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; 
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;

@Api(
       value ="测试pdf",
       tags = {"测试pdf"})

@RestController
@RequestMapping("/pdf")
public class TestPdfController {

   @Autowired
   private TestPdfService testPdfService;

   @Autowired
   private SpringUtils springUtils;

   @ApiOperation("查询测试pdf")
   @RequestMapping(value = "/B109830",method = RequestMethod.POST)
   public ResponseUtils queryTestPdf(@Validated @RequestBody QueryTestPdfVo queryTestPdfVo){
       H5UserinfoPo h5UserinfoPo = springUtils.getUserByToken(ThreadLocalContext.getToken());
       return testPdfService.queryTestPdf(queryTestPdfVo);
   }

   @ApiOperation("easyExcel导出测试pdf")
   @RequestMapping(value = "/B109831",method = RequestMethod.POST)
   public ResponseUtils exportTestPdf(HttpServletResponse httpServletResponse, 
                                                @Validated @RequestBody QueryTestPdfVo queryTestPdfVo){
       H5UserinfoPo h5UserinfoPo = springUtils.getUserByToken(ThreadLocalContext.getToken());
       return testPdfService.exportPdf(httpServletResponse,h5UserinfoPo, queryTestPdfVo) ;
   }

}
